#ifndef CONFIG_H
#define CONFIG_H

enum {
	ID_ATOM_COLOR_DEFAULT = 0,
	ID_ATOM_COLOR_HYDROGEN,
	ID_ATOM_COLOR_OXYGEN,
	ID_ATOM_COLOR_CHLORINE,
	ID_ATOM_COLOR_NITROGEN,
	ID_ATOM_COLOR_CARBON,
	ID_ATOM_COLOR_SULPHUR,
	ID_ATOM_COLOR_PHOSPHORUS,

	ID_SECONDARY_COLOR_DEFAULT,
	ID_SECONDARY_COLOR_ALPHA,
	ID_SECONDARY_COLOR_BETA,
	ID_SECONDARY_COLOR_DNA,

	ID_COLOR_3D_BG,
	ID_COLOR_3DSelColor,
	ID_COLOR_3DSelRecentColor,
	ID_COLOR_3DText,

	ID_COLOR_TEXT,
	ID_COLOR_textBgColor,
	ID_COLOR_textHidden,

	ID_COLOR_textBgColor2,
	ID_COLOR_textBgColorChain,

	ID_COLOR_textSelColor,
	ID_COLOR_textSelBgColor,
	ID_COLOR_textSelRecentColor,
	ID_COLOR_textSelRecentBgColor,

	ID_COLOR_Hbond,

	NUM_COLORS
};


enum IntIds{
	ID_DEFAULT_WIDTH = 0,
	ID_DEFAULT_HEIGHT,
	ID_SHOW_RESIDUES,
	ID_RESIDUE_SPLITTER_POS,
	ID_SHOW_SEQUENCES,
	ID_SEQUENCE_SPLITTER_POS,
	ID_ROTATION_MODE,
	ID_ALIGNMENT_FLAGS,
	ID_WEB_IN_NEW_WINDOW,
	ID_DRAW_MODE,

	ID_CARTOON_RES,
	ID_SPHERE_RES,
	ID_CYL_RES,
	NUM_INTS
};

enum StringIds {
	ID_PDB_PATH = 0,
	ID_PDB_URL,
	ID_ASTRAL_PATH,
	ID_ASTRAL_URL,
	ID_LAST_OPEN_WEB,
	NUM_CONFIG_STRINGS
};

// Id used for first of draw mode radio buttons.
// Can't be from 0 to NUM_COLORS+NUM_INTS+NUM_CONFIG_STRINGS,
// to avoid a control id conflict
#define ID_DRAW_MODE_BASE	(NUM_CONFIG_STRINGS+NUM_INTS+NUM_COLORS)

enum DrawMode {
	DRAW_MODE_SLOW,
	DRAW_MODE_INTERLEAVED_ARRAYS,
	DRAW_MODE_DISPLAY_LISTS,
	NUM_DRAW_MODES,
	// Not currently used.
	DRAW_MODE_VBO
};

enum ButtonIds {
	ID_USE_DEFAULT_COLORS = NUM_COLORS + NUM_INTS + NUM_CONFIG_STRINGS,
	ID_LOW_QUALITY,
	ID_MEDIUM_QUALITY,
	ID_HIGH_QUALITY,
};

class Config {
private:
	void LoadSave(int load);
public:
	Config& operator=(const Config& cfg);
	wxString *firstString;

	void UseQualityPreset(unsigned int preset);

	struct {
		wxString pdbPath;
		wxString pdbUrl;
		wxString astralPath;
		wxString astralUrl;
		wxString lastOpenWeb;
	} strings;

	Color *firstColor;
	struct {
		Color atomicColors[ID_SECONDARY_COLOR_DEFAULT];
		Color secondaryColors[4];

		Color color3DBg;
		Color colorSel;
		Color colorSelRecent;
		Color colorText3D;

		Color colorText;
		Color colorTextBg;
		Color colorHidden;

		Color colorTextBg2;
		Color colorTextBgChain;

		Color colorTextSel;
		Color colorTextSelBg;

		Color colorTextSelRecent;
		Color colorTextSelRecentBg;

		Color colorHBond;
	};

	union {
		int firstInt[1];
		struct {
			int defaultWidth;
			int defaultHeight;
			int showResidues;
			int residueSplitterPos;
			int showSequences;
			int sequenceSplitterPos;
			int rotationMode;
			int alignmentFlags;
			int webInNewWindow;
			unsigned int drawMode;
			int cartoonRes;
			int sphereRes;
			int cylRes;
		};
	};


	Config();

	void SetDefault();

	inline void Load() {
		LoadSave(1);
	}

	inline void Save() {
		LoadSave(0);
	}

	// Not an actual dialog class, but similar idea...
	int ShowModal(wxWindow *parent);

};

extern Config *config;

#endif
